<!--
 * @Descripttion: 
 * @version: 
 * @Author: mmzhang
 * @Date: 2021-07-20 15:04:42
 * @LastEditTime: 2022-07-22 13:50:25
-->
<template>
  <div class="room-msg">
    <p class="title">房源信息</p>
    <ul class="flex flex-wrap">
      <li class="flex" v-for="(item,index) in msgList" :key="index">
        <p class="text-right name"><span
            v-show="item.key=='roomName'">{{orderStatusName}}</span>{{item.name}}：</p>
        <p v-if="item.key=='productName'" class="ell product-name" :title="roomMsg[item.key]">
          {{roomMsg[item.key]}}</p>
        <p v-else-if="item.unit==''">{{roomMsg[item.key]}}{{item.unit}}</p>
        <p v-else>
          <span
            v-if="item.key=='area'">{{$tool.formatterMoney(roomMsg[item.key])}}{{item.unit}}<span
              v-if="adjustNum">({{adjustNum}}次调整
              <span class="view-log" @click="viewAdjustLog()">调整记录</span>）</span></span>
          <span v-else>{{$tool.formatterMoney(roomMsg[item.key])}}{{item.unit}}</span>
        </p>
      </li>
    </ul>
    <!--认购调整-->
    <sub-adjust-detail ref="subAdjustDetail" :detailMsg="detailMsg"></sub-adjust-detail>
    <!--签约调整-->
    <con-adjust-detail ref="conAdjustDetail" :detailMsg="detailMsg"></con-adjust-detail>
  </div>
</template>
<script>
  import subAdjustDetail from './subAdjustDetail.vue'
  import conAdjustDetail from './conAdjustDetail.vue'
  export default {
    props: ['detailMsg', 'orderStatusName'],
    data() {
      return {
        msgList: [
        {
          name: '房源',
          key: 'roomName',
          unit: '',
        },
        {
          name: '面积',
          key: 'area',
          unit: '㎡',
        },
        {
          name: '表单价',
          key: 'facePrice',
          unit: '元/㎡',
        },
        {
          name: '所属产品',
          key: 'productName',
          unit: '',
        }, {
          name: '表总价',
          key: 'faceTotalPrice',
          unit: '元',
        }],
        otherMsg: [
        {
          name: '底单价',
          key: 'basicPrice',
          unit: '元/㎡',
        }, {
          name: '底总价',
          key: 'basicTotalPrice',
          unit: '元',
        }],
        roomMsg: {},
        adjustNum: 0
      }
    },
    components: {
      subAdjustDetail,
      conAdjustDetail
    },
    mounted() {
      this.roomMsg = { ...this.detailMsg.orRoomDetailsVO }
      this.adjustNum = this.detailMsg.orAdjustmentDetailVOList.length

      if (this.detailMsg.orContractBaseInfoVO.coopMode == 4 || this.detailMsg
        .orContractBaseInfoVO
        .coopMode == 5) {
        this.msgList = this.msgList.concat(this.otherMsg)
      } else {
        this.msgList = this.msgList
      }
    },
    methods: {
      viewAdjustLog() {
        if (this.orderStatusName == '认购') {
          this.$refs.subAdjustDetail.show()
        } else {
          this.$refs.conAdjustDetail.show()
        }
      }
    }
  }
</script>
<style lang="scss" scoped>
  .room-msg {
    margin-top: 40px;

    ul {
      li {
        width: 50%;
        line-height: 50px;

        .name {
          width: 150px;
        }

        .product-name {
          width: calc(100% - 150px);
        }
      }

      .view-log {
        margin-left: 5px;
        color: #2d8cf0;
        cursor: pointer;
      }
    }
  }
</style>